
import 'package:dali_ng_pera/page/welcome/dnp_welcome_dis_widget.dart';
import 'package:dali_ng_pera/page/welcome/dnp_welcome_privacy_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';

import 'dnp_welcome_controller.dart';

class DnpWelcomeWidget extends StatefulWidget {
  const DnpWelcomeWidget({super.key});

  @override
  State<DnpWelcomeWidget> createState() => _DnpWelcomeWidgetState();
}

class _DnpWelcomeWidgetState extends State<DnpWelcomeWidget> {

  final controller = Get.put(DnpWelcomeController());

  @override
  void initState() {
    super.initState();
    controller.ctx = context;
  }

  @override
  void dispose() {
    super.dispose();
    Get.delete<DnpWelcomeController>();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: PageView.builder(
          physics: const ClampingScrollPhysics(),
          itemCount: 2,
          controller: controller.pageController,
          itemBuilder: (ctx,idx) {
            if (idx == 0) {
              return DnpWelcomeDisWidget();
            }else {
              return DnpWelcomePrivacyWidget();
            }
          }
      )
    );
  }
}
